#define _CRT_SECURE_NO_WARNINGS 1
#include"heap.h"

void HeapSort(int* a, int n)
{
	for (int i = 1; i < n; i++)
	{
		AdjustUp(a, i);
	}
	int end = n - 1;
	while (end > 0)
	{
		Swap(&a[0], &a[end]);
		AdjustDown(a, end, 0);
		--end;
	}
}

void test()
{
	int a[] = { 1,5,4,3,8,7,2,9,10,6 };
	HeapSort(a, sizeof(a) / sizeof(int));
}

int main()
{
	test();
	return 0;
}